<?php include("admin-header.php"); ?>

<script>
function edit(val){

document.getElementById('questionId').value= val;
document.getElementById('SubmitValues').click();

}
function del(val){

document.getElementById('questionId').value= val;
document.getElementById('form1').action='delete.php';
document.getElementById('SubmitValues').click();

}
</script>
<form id="form1" name="form1" method="post" action="edit.php">

<p><b>Following are the questions currently available for creating and editing.</b></p>
<?php 
	//<a onclick=\"document.getElementById('questionId').value=" . $arr[$i]->questionMasterId . "; \"> Edit </a>

//<a onclick=\"document.getElementById('questionId').value=" . $arr[$i]->questionMasterId . ";document.getElementById('form1').action='delete.php'; \"> Delete </a>

	$arr = DAOFactory::getQuestionmasterDAO()->queryByQuestionType(-1);
	if(count($arr)==0){
		echo "No Questions to perform edit or delete .";
	}
	echo "<table>";
	for($i=0;$i<count($arr);$i++){
		echo "<tr><td width=100px><input type=button value=Edit  onclick='edit(".$arr[$i]->questionMasterId.")' style='color:white;font-weight:bold;float:left;background-color:#1A6A96;width:80px;height:25'/></td>" ;
		echo "<td width=100px><input type=button value=Delete  onclick='del(".$arr[$i]->questionMasterId.")' style='color:white;font-weight:bold;float:left;background-color:#1A6A96;width:80px;height:25'/></td>";
		echo "<td width=300px>" . $arr[$i]->question . "</td></tr>";
	}
	
	echo "</table>";
	?>

  <input name="questionId"  id="questionId" type="hidden" id="questionId" value="" />
  <input type="submit" name="SubmitValues" id="SubmitValues" value="Submit" style="visibility: hidden"/>

  
  
</form>

<?php include("admin-footer.php"); ?>
